<?php
    @include_once("conn.php");
    @include_once("common.php");
    $id=$_GET["id"];
    $chinese=$_GET["chinese"];
    $math=$_GET["math"];
    $english=$_GET["english"];
    
    if(!$id){
        $msg=array();
        $msg["status"]=false;
        $msg["detail"]="请输入完整参数";
        exit(json_encode($msg));
    }
    $rearch="update `study` set chinese=$chinese,math=$math,english=$english where id=$id";

    mysqli_query($conn,$rearch);

    $rows=mysqli_affected_rows($conn);

    $data=array();
    if($rows>0){
        $data["status"]=true;
        $data["detail"]="更新成功";
        
    }else if($rows==0){
        $data["status"]=true;
        $data["detail"]="数据已经更新";
    }else{
        $data["status"]=false;
        $data["detail"]="数据更新失败";
        $data["sql"]=$rearch;
    }
    echo json_encode($data);
?>